'''Module representing cards used in the game'''

import game_constants 

class Card(object):
    valid_names = set()
    
    def __init__(self, name, image = None):
        if name not in self.valid_names:
            type_name = self.__class__.__name__
            raise Exception( 'Invalid %s name: %s' % (type_name, name))

        self.name = name
        self.image = image

    def __repr__(self):
        return 'Game card: %s' % (self.name)
        
class WeaponCard(Card):
    valid_names = game_constants.g_weapons

    def __init__(self, name, image = None):
        super(WeaponCard, self).__init__(name, image)


class RoomCard(Card):
    valid_names = set(game_constants.g_rooms.iterkeys())
    def __init__(self, name, image = None):
        super(RoomCard, self).__init__(name, image)



class CharacterCard(Card):
    valid_names = set(game_constants.g_characters.iterkeys())
    def __init__(self, name, image = None):
        super(CharacterCard, self).__init__(name, image)


if __name__ == '__main__':
    pass
